# coding=utf-8
import traceback

import pymysql.cursors

from tests.modules.ucloud.servers import servers
from tests.modules.ucloud.ucloud_db import UcloudApp

servers = [
    '172.16.2.176',
]

def deal_all_db():
    for ser in servers:
        _ip = ser

        uc = UcloudApp(ip=_ip)

        try:

            uc.do_insert(app_name='ubarrier-agent',
                         zone='uc.gzidc.area',
                         zone_alias='gzidc',
                         port=6200,
                         app_type='spring-boot',
                         db_name=None,
                         mem_level=1,
                         db_type=None)

            uc.commit()


            uc.do_insert(app_name='ubarrier-master',
                         zone='uc.gzidc.area',
                         zone_alias='gzidc',
                         port=6210,
                         app_type='spring-boot',
                         db_name=None,
                         mem_level=1,
                         db_type=None)

            uc.commit()


        except BaseException, ex:
            print ex.message

        finally:

            uc.close()


deal_all_db()
